<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
		<link rel="stylesheet"  href="css/Main.css" type="text/css" >
	</head>
	<body>

		<div id="div">
			<form action="show.jsp" method="post" class="filech" id="filech" name="filech">
			<fieldset class="filefield">
				<legend>请选择一个文件：</legend>

				<input type="input" name="file" placeholder="请在此输入文件路径" >
				<input type="hidden" value="" name="ch">
				<input type="submit" value="上传" id="1" name="1" onclick= "ch.value= '上传' " onchange="selectxt(this)">
			</fieldset>
			<fieldset class="textfield">
				<textarea  id="textarea" placeholder="请点击上面按钮选择文件或直接在此输入文本" name="textarea"></textarea>
			</fieldset>
			
		</form>
		
		<textarea class="dealtext" id="result" readonly ></textarea>

		</div>
		<div class="but">
		<input type="submit" form="filech" value="详细统计" id="2" name="2" onclick= "ch.value= '详细统计' "/>
		<input type="submit" form="filech" value="字符统计" id="3" name="3" onclick= "ch.value= '字符统计' "/>
		
		<input type="submit" form="filech" value="行数统计" id="4" name="4" onclick= "ch.value= '行数统计' "/>
		<input
			type="submit" form="filech" value="单词统计" 
			onclick="ch.value= '单词统计' " />
		<input type="submit" form="filech" value="词频统计" id="5" name="5" onclick= "ch.value= '词频统计' "/>
		<input type="number" form="filech" placeholder="请输入词组数量" name="group" />
		<input type="submit" form="filech" value="词组统计" id="6" onclick= "ch.value= '词组统计' " />
		</div>
		 <script type="text/javascript">
             var txt = '';
             function selectxt(file){
                 if(!file.files||!file.files[0]){
                     return;
                 }
                 var reader = new FileReader();
                 reader.onload = function(evt){
                   
                     txt = evt.target.result;
                 }
                 reader.readAsDataURL(file.files[0]);
             }
        </script>
	</body>
</html>
